package com.gitee.ed.arithmetic.leetcode.question.question_1_100.question_1_10;

import com.gitee.ed.arithmetic.leetcode.SolutionRunner;
import com.gitee.ed.arithmetic.leetcode.common.Question;
import com.gitee.ed.arithmetic.leetcode.solution.solution_1_100.solution_1_10.Solution5;

/**
 * @author hongda.li
 */
public class Question5 implements Question<Solution5> {
    @Override
    public String link() {
        return "https://leetcode.cn/problems/longest-palindromic-substring/description/";
    }

    @Override
    public String title() {
        return "5.最长回文子串";
    }

    @Override
    public String description() {
        return """
                给你一个字符串 s，找到 s 中最长的回文子串，
                如果字符串的反序与原始字符串相同，则该字符串称为回文字符串。
                """;
    }

    @Override
    public void test(Solution5 solution) {
        this.test1(solution);

        this.test2(solution);
    }

    private void test1(Solution5 solution) {
        SolutionRunner.checkString("bab", solution.longestPalindrome("babad"));
    }

    private void test2(Solution5 solution) {
        SolutionRunner.checkString("bb", solution.longestPalindrome("cbbd"));
    }
}
